home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Family Forum 257
/
SOMC Family Forum 257 - Disc 2.iso
/
SHOPPING.DIR
/
00045_Field_45.txt
< prev
next >
Wrap
Text File
|
1997-05-30
|
5KB
|
194 lines
-- Build Shopping List method
-- NOTE: this handler has been locked on for testing in Alison's version of
-- the Shopping.dir. •••••••••••••••••¥
on AddToShopList vRxID
-- builds and updates a list of shopping data stored in the global gShopRxList.
-- This list provides the data for collating at the "Shopping List" module.
global gGrabHandCursor
global gNavOffset, gShopRxList
set RxListings = [:] -- temporary storage for this recipes shopping information
-- UNCOMMENT THIS IN RECIPE.DIR -- ΓÇóΓÇóΓÇó
-- if the stillDown then
-- if the mouseCast = the number of cast "Title" then
-- cursor gGrabHandCursor
-- end if
-- end if
--
-- repeat while the mouseDown
-- if rollover(gNavOffset + 8) then
-- set addRx = TRUE
-- else
-- set addRx = FALSE
-- end if
-- end repeat
-- cursor -1
set addRx = TRUE -- COMMENT THIS OUT IN RECIPE.DIR -- ΓÇóΓÇóΓÇó
if addRx then
-- Check for Duplicate
set dup = FALSE
if NOT voidP(gShopRxList) then
repeat with x = 1 to count(gShopRxList)
if vRxID = getAt(getAt(gShopRxList, x),1) then
set dup = TRUE
exit repeat
end if
end repeat
else
set gShopRxList = []
end if
if not dup then
-- puppetSound 2, the number of cast "Drop"
-- updateStage
addProp (RxListings, #RecipeID, vRxID)
set Result = PointAtRec(vRxID, #Rx)
if not Result then
addProp (RxListings, #Title, GetField(kDBTitle))
addProp (RxListings, #Servings, GetField(kDBServings))
addProp (RxListings, #Scaled, GetField(kDBServings))
end if
-- Build Ingredients List
set IngList = []
set Result = PointAtRec(vRxID, #Ing)
set num = 1
repeat while Result <> 2
set NextIngrList = value("#" & "Ingredient" & num)
set newList = [:]
if GetField(kDBNoQuantity) <> "|" then
addProp (newList, #IngrLine, GetField(kDBNoQuantity))
addProp (newList, #Quantity, value(GetField(kDBQuantity)))
addProp (newList, #Unit, GetField(kDBUnit))
addProp (newList, #Category, GetField(kDBCollate))
addProp (RxListings, NextIngrList, newList)
end if
set Result = PointNextRec(#Ing)
set num = num + 1
end repeat
put RxListings -- ΓÇóΓÇóΓÇó
add (gShopRxList, RxListings)
end if
end if
end AddToShopList
-- Data Retrieval and Set methods for use after Recipes Sent to ShoppingList
on GetShopRxList listPos
-- Returns the Shopping Recipe data list object at 'listPos' in the gShopRxList.
-- Returned list contains all "Shopping List" ingredient data for that recipe.
global gShopRxList
return getAt(gShopRxList, listPos)
end GetShopRxList
on GetShopRxID rxShopList
-- Returns the database recipe record ID integer for the recipe ingredient
-- data list (rxShopList).
return getProp(rxShopList, #recipeID)
end GetShopRxID
on GetShopRxTitle rxShopList
-- Returns the recipe title string for the recipe ingredient
-- data list (rxShopList).
return getProp(rxShopList, #title)
end GetShopRxTitle
on GetShopRxServings rxShopList
-- Returns the number of recipe servings string for the recipe ingredient
-- data list (rxShopList).
return getProp(rxShopList, #servings)
end GetShopRxServings
on GetShopRxScaled rxShopList
-- Returns number of scaled servings string for the collated recipe ingredient
-- data list (rxShopList). (NOTE: Before collating this value is the same as
-- the "servings" uncollated.
return getProp(rxShopList, #scaled)
end GetShopRxScaled
on SetShopRxScaled rxShopList, collatedVal
-- Sets the scaled servings value string.
-- Should be used at collate time.
setProp(rxShopList, #scaled, collatedVal)
end SetShopRxScaled
on GetShopRxIngrDataList rxShopList, ingrNumLine
-- Returns the ingredient sublist object from the recipe ingredient
-- data list (rxShopList).
set thisIngredient = value("#ingredient" & ingrNumLine)
return getProp(rxShopList, thisIngredient)
end GetShopRxIngrDataList
on GetShopRxIngrLine rxIngrList
-- Returns the ingredient line string for the recipe ingredient
-- data list (rxShopList).
return getProp(rxIngrList, #IngrLine)
end GetShopRxIngrLine
on GetShopRxIngrQty rxIngrList
-- Returns the database recipe record ID integer for the recipe ingredient
-- data list (rxShopList).
return getProp(rxIngrList, #quantity)
end GetShopRxIngrQty
on GetShopRxIngrUnit rxIngrList
-- Returns the servings unit float value for the recipe ingredient
-- data list (rxShopList).
return getProp(rxIngrList, #unit)
end GetShopRxIngrUnit
on GetShopRxIngrCat rxIngrList
-- Returns the category string for the recipe ingredient
-- data list (rxShopList).
return getProp(rxIngrList, #category)
end GetShopRxIngrCat